<?php
namespace Game\Entity;

use Symfony\Component\HttpFoundation\Request;

/**
 * @Entity
 */
class Person extends Character
{
    public function executeCommand(Request $request)
    {
        $command = $request->get('command');
        if( !$command )
            throw new \Game\Exception\Environment\CommandNotDefineException('There is no "command" parameter in request');

        if( !$this->getActions()->containsKey($command) )
            return FALSE;

        $action = $this->getAction($command);
        $action->execute(NULL);
        return $action->render();
    }
}